import route from "@/router"
import store from "@/store"
//白名单
const whiteList = ["/login"]

//定义路由全局守卫
route.beforeEach(async (to, from, next)=>{
    let userinfo = store.state.user.userInfo;
    if (userinfo) {
        // document.getElementById('canvas_sakura').style.display = 'none';
        if(to.path === "/login"){
            return next("/");     //禁止访问   
        }
        return next()
    }else{

       if( whiteList.includes(to.path)){
           next();
       }else{
           next("/login");
       }
    }
})